//
//  LanguageTableViewCell.m
//  ChartsDemo
//
//  Created by wusiping on 2021/4/1.
//

#import "LanguageTableViewCell.h"

@interface LanguageTableViewCell()

@property (nonatomic,strong) UILabel *topLabel;
@property (nonatomic,strong) UIImageView *rightImageView;
@property (nonatomic,strong) UIView *seperageView;

@end

@implementation LanguageTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self  = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self UIConfig];
    }
    return self;
}

- (void)UIConfig
{

    _topLabel = [[UILabel alloc] init];
    _topLabel.font = [UIFont systemFontOfSize:15];
    _topLabel.textColor = J_ColorFromHEX(0x222222);
    [self addSubview:_topLabel];
    [_topLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left).offset(15);
        make.height.mas_equalTo(19);
        make.centerY.equalTo(self);
    }];
    
    _rightImageView = [[UIImageView alloc] init];
    [self addSubview:_rightImageView];
    [_rightImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.width.height.mas_equalTo(30);
        make.right.equalTo(self.mas_right).offset(-15);
        make.centerY.equalTo(self);
    }];
    [_rightImageView setImage:[UIImage imageNamed:@"commen_ic_select_n"]];
    
    _seperageView = [[UIView alloc] init];
    [self addSubview:_seperageView];
    [_seperageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.height.mas_equalTo(0.5);
        make.left.right.equalTo(self);
        make.bottom.equalTo(self);
    }];
}

- (void)configCellWithTitle:(NSString *)title isChoose:(BOOL)isChoose
{
    if (isChoose) {
        _rightImageView.image = [UIImage imageNamed:@"commen_ic_select_s"];
    }else{
        _rightImageView.image = [UIImage imageNamed:@"commen_ic_select_n"];

    }
    _topLabel.text = title;
}

- (void)configCellWithAttributeString:(NSAttributedString *)attribute isChoose:(BOOL)isChoose{
    if (isChoose) {
        _rightImageView.image = [UIImage imageNamed:@"commen_ic_select_s"];
    }else{
        _rightImageView.image = [UIImage imageNamed:@"commen_ic_select_n"];

    }
    _topLabel.attributedText = attribute;
}

@end
